package com.gf.message.dao;

import java.util.List;

import com.gf.base.type.MessageState;
import com.gf.base.type.MessageType;
import com.gf.common.bean.Page;
import com.gf.message.model.Message;

public interface MessageDao {

	/**
	 * 插入单条新消息
	 * 
	 * @param senderId
	 * @param senderName
	 * @param receiveId
	 * @param draftReceiveIds
	 * @param title
	 * @param content
	 * @param messageType
	 * @param senderState
	 * @param receiverState
	 * @return
	 */
	public long insert(long senderId, String senderName, long receiveId,
			String draftReceiveIds, String draftReceiveNames, String title,
			String content, MessageType messageType, MessageState senderState,
			MessageState receiverState);

	/**
	 * 批量插入
	 * 
	 * @param senderId
	 * @param senderName
	 * @param receiveIds
	 * @param title
	 * @param content
	 * @return 成功插入的条数
	 */
	public int batchInsert(long senderId, String senderName, Long[] receiveIds,
			String draftReceiveIds, String draftReceiveNames, String title,
			String content, MessageType messageType, MessageState senderState,
			MessageState receiverState);

	/**
	 * 得到自己发送的消息和草稿
	 * 
	 * @param senderID
	 * @return
	 */
	public List<Message> queryMessagesByMessageType(long senderId,
			MessageType messageType, Page page);

	/**
	 * 得到自己接收的消息
	 * 
	 * @param receiveId
	 * @param page
	 * @return
	 */
	public List<Message> queryReceiveMessages(long receiveId, Page page);

	/**
	 * 更新消息的类型
	 * 
	 * @param id
	 * @param messageType
	 */
	public void updateMessageType(long id, MessageType messageType);

	/**
	 * 更改消息的状态(对发送人而言)
	 * 
	 * @param id
	 * @param messageState
	 */
	public void updateSenderState(long id, MessageState senderState);

	/**
	 * 更改消息的状态(对接收人而言)
	 * 
	 * @param id
	 * @param messageState
	 */
	public void updateReceiverState(long id, MessageState receiverState);

	/**
	 * 得到未读消息的数量
	 * 
	 * @param receiveId
	 * @return
	 */
	public int queryNumberOfUnreadMessages(long receiveId);

	/**
	 * 得到全部的收到的信息
	 * 
	 * @param receiveId
	 * @return
	 */
	public int queryNumberOfReceiveMessages(long receiveId);

	/**
	 * 得到自己发送或草稿的消息总数
	 * 
	 * @param senderID
	 * @return
	 */
	public int queryNumberByMessageType(long senderId, MessageType messageType);
}
